import { createStore } from 'vuex'

import cart from './modules/cart'
import category from './modules/category'
import user from './modules/user'

import createPersistedState from "vuex-persistedstate"

export default createStore({
  state: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    cart,
    category,
    user
  },
  // 配置vuex插件的地方
  plugins: [ 
    createPersistedState({
      // 此插件默认储存在localstorage
      // 储存的名字
      key: 'rabbit-xianer-mall',
      // 指定需要储存的模块
      paths: [ 'user', 'cart', 'category']
    })
  ]
})